﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace WGM_Silverlight.Controls
{
    public partial class CategoryButton : UserControl
    {
        public CategoryButton()
        {
            InitializeComponent();
        }
        
        string _title = String.Empty;


        /// <summary>
        /// Title of the toolbar item
        /// </summary>
        public string Title
        {
            get { return _title; }
            set { _title = value; }
        }
        public double DisplayTextSize
        {
            get { return _itemText.FontSize; }
            set { _itemText.FontSize = value; }
        }
        public Brush DisplayBackground
        {
            get { return _background.Background; }
            set { _background.Background = value; }
        }
        public Brush DisplayTextColour
        {
            get { return _itemText.Foreground; }
            set { _itemText.Foreground = value; }
        }

        /// <summary>
        /// The transition color when we hover over the button
        /// </summary>
        public Color TransitionColor
        {
            get
            {
                return transitionColor.Color;
            }
            set
            {
                transitionColor.Color = value;
                transitionSubColor.Color = Color.FromArgb(64, value.R, value.G, value.B);
            }
        }

        /// <summary>
        /// The source of the image to display for the control
        /// </summary>
        public string DisplayText
        {
            get { return _itemText.Text; }
            set { _itemText.Text = value; }
        }

        private void LayoutRoot_MouseEnter(object sender, MouseEventArgs e)
        {
            _animEnter.Begin();
        }

        private void LayoutRoot_MouseLeave(object sender, MouseEventArgs e)
        {
            _animLeave.Begin();

        }
        public void ClearAnimation()
        {
            _animLeave.Begin();
        }
        /// <summary>
        /// true to open link in new window, false to open link in current window
        /// default is false
        /// </summary>
        public bool OpenInNewWindow { get; set; }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

        }
    }
}
